﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no, maximum-scale=1.0" />
    <title>特种设备</title>
    <link rel="stylesheet" type="text/css" href="/css/common.css" />
    <link rel="stylesheet" type="text/css" href="/css/index.css" />
    <link rel="stylesheet" type="text/css" href="/css/equipment.css" />
    <link rel="stylesheet" type="text/css" href="/css/pullToRefresh.css" />
    <link rel="stylesheet" type="text/css" href="/css/enterprise.css" />
</head>

<body class="bg_ef">
    <div class="container">
        <div class="header">
            <div class="headbg"><a href="/index.html" class="return"></a></div>
            <p>特种设备</p>
        </div>
        <div class="tz_seach">
            <div class="box">
                <input type="text" placeholder="请输入企业名称或者点评类型" id="SearchValue" />
                <input type="button" value="搜索" onclick="SearchSubmit()" />
            </div>
        </div>
        <div class="main" id="wrapper">
            <ul class="laws" id="lawUl"></ul>
        </div>
    </div>
</body>
</html>

<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script>
<script src="/static/usi/core.js"></script>
<script src="/static/usi/tools.js"></script>
<script src="/js/iscroll.js"></script>
<script src="/js/pullToRefresh.js"></script>
<script>
    refresher.init({
        id: "wrapper",
        divId: "scroller",
        pullUpAction: Load,
        pullDownAction: Refresh,
    });

    function Refresh() {
        myScroll.refresh();
    }
    function Load() {
        if (isData) {
            if (_val != $("#SearchValue").val()) {
                $("#lawUl").html("");
                vcurrentPage = 1;
            }
            else
                vcurrentPage = vcurrentPage + 1;
            LoadNewsData();
            myScroll.refresh();
        } else {
            myScroll.refresh();
        }
    }
    var vcurrentPage = 1;
    window.onload = function () {
        LoadNewsData();
    }
    function SearchSubmit() {
        $("#lawUl").html("");
        isData = true;
        vcurrentPage = 1;
        _val = $("#SearchValue").val();
        LoadNewsData();
    }
    var isData = true;
    var _val = "";
    function LoadNewsData() {
        _val = $("#SearchValue").val();
        jQuery.usi.core.get(ip + api + "/GetEquipmentArchiveData", { whereValue: $("#SearchValue").val(), currentPage: vcurrentPage, pageSize: 3 }, false, function (data) {
            if (!jQuery.usi.core.isNullOrEmpty(data.data)) {
                $.each(data.data, function (index, item) {
                    //var div = $("<div class='index-single'></div>");
                    //div.bind("click", function () {
                    //    window.location.href = "/page/equipmentDetail.html?Unid=" + item.unid;
                    //});
                    //var div1 = $("<div class='single-img'><img src='/image/qiye.png'></div>");
                    //var div2 = $("<div class='single-title'></div>");
                    //var ul = $("<ul class='laws'>");
                    //var li = $('<li></li>');
                    //var name = "无";
                    //if (!jQuery.usi.core.isNullOrEmpty(item.useUnitArchiveForEquipment) && !jQuery.usi.core.isNullOrEmpty(item.useUnitArchiveForEquipment.name))
                    //    name = item.useUnitArchiveForEquipment.name;
                    //else if (!jQuery.usi.core.isNullOrEmpty(item.maintainUnitArchiveForEquipment) && !jQuery.usi.core.isNullOrEmpty(item.maintainUnitArchiveForEquipment.name))
                    //    name = item.maintainUnitArchiveForEquipment.name;
                    //var p1 = $('<p class="exam_title">' + name + '</p>');
                    //var p2 = $('<p class="exam_p"><span class="lab">设备名称:</span>' + (jQuery.usi.core.isNullOrEmpty(item.equName) ? "" : item.equName) + '</p>');
                    //li.append(p1).append(p2);
                    //ul.append(li);
                    //div2.append(ul);
                    //div.append(div1).append(div2);
                    //$("#wrapper").append(div);


                    var li = $('<li></li>');
                    var a = $('<a href="#"></a>');
                    var name = "无";
                    if (!jQuery.usi.core.isNullOrEmpty(item.unitArchiveName))
                        name = item.unitArchiveName;
                    else if (!jQuery.usi.core.isNullOrEmpty(item.maintainUnitArchiveName))
                        name = item.maintainUnitArchiveName;
                    var p1 = $('<p class="exam_title">' + name + '</p>');
                    var p2 = $('<p class="exam_p"><span class="lab">设备名称:</span>' + (jQuery.usi.core.isNullOrEmpty(item.equName) ? "" : item.equName) + '</p>');
                    a.bind("click", function () {
                        window.location.href = "/page/equipmentDetail.html?Unid=" + item.unid;
                    });
                    a.append(p1).append(p2);
                    li.append(a);
                    $("#lawUl").append(li);
                });
            } else {
                layer.alert("未查询到信息！");
                isData = false;
            }
        });

    }

</script>
<style>

</style>